package io.scnb.lesson001.demo26.test9;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class InjectService {
    /**
     * 当类上没有标注@Qualifier注解时，可以任务bean的名称就是限定符的值
     * 所以这里会注入Service2的实例
     */
    @Autowired
    @Qualifier("service2")
    private IService service;

    @Override
    public String toString() {
        return "InjectService{" +
                "service=" + service +
                '}';
    }
}
